﻿<urlset>
{php $tmp = "";}
	{loop $dataarray $n $r}								
	{php if (trim($tmp)==trim($r['title'])) continue;}
    {php $r['group_buynum']=$r['group_buynum']+$r['group_startnum'];}
    {php $r['group_usernum']=$r['group_usernum']+$r['group_startnum'];}
	
		{if $r['stock']>$r['group_buynum']}
		<url>
		<loc>http://www.buy917.com/view.php?gid={$r['gid']}</loc>
		<data>
		<display>
        	<id>{$r['gid']}</id>
            <website>Buy917--買，揪一起 團購網</website>
            <siteurl>http://www.buy917.com/</siteurl>
            <city>Taipei</city>
            <title>{$r['title']}</title>
            <image>http://www.buy917.com/{$r['filepath']}</image>
            <startTime>{$r['group_begin_time']}</startTime>
            <endTime>{$r['group_end_time']}</endTime>
            <value>{$r['market_price']}</value>
            <price>{$r['shop_price']}</price>
            <rebate>{php $pic=($r['shop_price']*10/$r['market_price']); echo sprintf("%1.1f",$pic)}</rebate>
            <bought>{$r['group_buynum']}</bought>        
        </display>
		</data>
		</url>
		{/if}
	{php $tmp=$r['title'];}
{/loop}
</urlset>